package routers

import (
	"LoveU/controllers"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/plugins/cors"
)

func init() {

	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
		AllowAllOrigins:  true,
		AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
		ExposeHeaders:    []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
		AllowCredentials: true,
	}))

	beego.Router("/", &controllers.LoginController{})

	//用户登录
	beego.Router("/login", &controllers.LoginController{}, "post:Login")

	//用户退出登录
	beego.Router("/logout", &controllers.LoginController{}, "post:Logout")

	//检查用户名可用
	beego.Router("/checkName", &controllers.LoginController{}, "post:CheckName")

	//注册
	beego.Router("/register", &controllers.LoginController{}, "post:Register")

	//检查用户是否在线
	beego.Router("/checklogin", &controllers.LoginController{}, "get:CheckLogin")

	//上传用户头像
	beego.Router("/uploadavatar", &controllers.FileController{}, "post:UpLoadAvatar")

	//修改用户头像
	beego.Router("/modifyavatar", &controllers.FileController{}, "post:ModifyAvatar")

	//上传用户相册
	beego.Router("/uploadalumb", &controllers.FileController{}, "post:UpLoadAlumb")

	//获取用户相册信息
	beego.Router("/getalbums", &controllers.FileController{}, "post:GetAlbums")
	//获取用户相册图片链接
	beego.Router("/getalbum", &controllers.FileController{}, "post:GetAlbum")
	//获取好友相册图片链接
	beego.Router("/getfriendalbum", &controllers.FileController{}, "post:GetFriendAlbum")
	//获取好友相册
	beego.Router("/getfriendsalbums", &controllers.FileController{}, "post:GetFriendsAlbums")

	beego.Router("/uploadphoto", &controllers.FileController{}, "post:UploadPhoto")

	//获取用户的所有好友之头像
	beego.Router("/getavatar", &controllers.FileController{}, "post:GetAvatar")

	//返回心情列表
	beego.Router("/moodlist", &controllers.MoodController{}, "post:MoodList")

	//返回某心情或评论下的评论
	beego.Router("/moodlist/comment", &controllers.MoodController{}, "post:CommentList")

	//发布心情
	beego.Router("/publishmood", &controllers.MoodController{}, "post:PublishMood")

	//发表评论
	beego.Router("/publishmood/comment", &controllers.MoodController{}, "post:PublishComment")

	//删除评论
	beego.Router("/deletemood/comment", &controllers.MoodController{}, "post:DeleteComment")

	//删除心情
	beego.Router("/deletemood", &controllers.MoodController{}, "post:DeleteMood")

	//完善用户信息
	beego.Router("/perfectinfor", &controllers.Usercontroller{}, "post:PerfectInfor")
	//获取用户信息
	beego.Router("/getuserinfo", &controllers.Usercontroller{}, "post:GetUserInfo")
	//VIP申请
	beego.Router("/viprequest", &controllers.Usercontroller{}, "post:RequestVIP")
	//检查VIP状态
	beego.Router("/vipcheck", &controllers.Usercontroller{}, "post:CheckVIP")
	// 修改兴趣爱好
	beego.Router("/modifyhobby", &controllers.Usercontroller{}, "post:ModifyHobby")
	//修改签名
	beego.Router("/modifyautograph", &controllers.Usercontroller{}, "post:ModifyAutograph")
	// 修改性别
	beego.Router("/modifygentle", &controllers.Usercontroller{}, "post:ModifyGentle")
	//修改生日
	beego.Router("/modifybirthday", &controllers.Usercontroller{}, "post:ModifyBirthday")
	//修改地域
	beego.Router("/modifyarea", &controllers.Usercontroller{}, "post:ModifyArea")
	// 修改职业
	beego.Router("/modifyjob", &controllers.Usercontroller{}, "post:ModifyJob")
	// 修改工资
	beego.Router("/modifysalary", &controllers.Usercontroller{}, "post:ModifySalary")
	// 是否有孩子
	beego.Router("/modifyhavekids", &controllers.Usercontroller{}, "post:ModifyHaveKids")
	// 父母是否健在
	beego.Router("/modifyparentsalive", &controllers.Usercontroller{}, "post:ModifyParentsalive")
	// 情感状况
	beego.Router("/modifyemotion", &controllers.Usercontroller{}, "post:ModifyEmotion")
	//婚姻状况
	beego.Router("/modifymaritallstatus", &controllers.Usercontroller{}, "post:ModifyMaritallstatus")
	// 修改需求
	beego.Router("/modifymequir", &controllers.Usercontroller{}, "post:ModifyRequir")

	//添加好友
	beego.Router("/addfriend", &controllers.FriendController{}, "post:AddFriend")
	//根据好友名字添加好友
	beego.Router("/addfriendbyname", &controllers.FriendController{}, "post:AddFriendByName")
	//删除好友
	beego.Router("/removefriend", &controllers.FriendController{}, "post:RemoveFriend")
	//返回好友列表
	beego.Router("/getfriends", &controllers.FriendController{}, "post:GetFriends")
	//返回好友申请列表
	beego.Router("/getrequest", &controllers.FriendController{}, "post:GetFriendsRequest")
	//返回自己发出的好友申请
	beego.Router("/getrequest/me", &controllers.FriendController{}, "post:GetMyFriendsRequest")
	//确认好友申请
	beego.Router("/agreerequest", &controllers.FriendController{}, "post:AgreeRequest")

	//以“部分用户名”搜索用户
	beego.Router("/search/user/name", &controllers.SearchController{}, "post:SearchUserByName")
	//获得所有用户的相对“缘分”得分、部分信息（试运行）
	beego.Router("/search/user/destiny", &controllers.SearchController{}, "post:SearchUserByDestiny")

	// 获取（服务器记录的）全国省份（市、区），或该省的所有地级市，或该市的所有县级单位
	// 【注意】若province为"0"、country不为"0"，或两项均为空，则返回所有地名记录
	beego.Router("/search/area/all", &controllers.SearchController{}, "post:GetAreaAll")
	//获取全国省份（市、区）列表
	beego.Router("/search/area/province", &controllers.SearchController{}, "post:GetProvinceList")
	//获取某省的所有地级市（对于直辖市、特别行政区，返回自身）
	beego.Router("/search/area/country", &controllers.SearchController{}, "post:GetCountryList")
	//获取某地级市（直辖市、特别行政区）的所有县级单位。和/search/area/all共用接口
	beego.Router("/search/area/county", &controllers.SearchController{}, "post:GetAreaAll")
	//根据areaid，或行政区划编号（分三段），返回唯一对应的地区代码、名称
	beego.Router("/search/area/id", &controllers.SearchController{}, "post:GetAreaById")

	//获取最新活动
	beego.Router("/getactivity", &controllers.ActivityController{}, "post:GetActivity")
	//参加活动
	beego.Router("/attendactivity", &controllers.ActivityController{}, "post:AttendActivity")
	//取消活动
	beego.Router("/cancelactivity", &controllers.ActivityController{}, "post:CancelActivity")
	//返回活动圈列表
	beego.Router("/getallactivity", &controllers.ActivityController{}, "post:GetActivities")
	//返回我参加的活动
	beego.Router("/getuseractivity", &controllers.ActivityController{}, "post:GetMyActivities")

	//获取名言
	beego.Router("/getaphorism", &controllers.OtherController{}, "post:GetAphorism")
	//获取版本更新
	beego.Router("/getlastedition", &controllers.OtherController{}, "post:GetLastEdition")

	//管理员登录
	beego.Router("/adminlogin", &controllers.AdminController{}, "post:AdminLogin")
	//管理员获取vip申请list
	beego.Router("/admin/viplist", &controllers.AdminController{}, "post:VipRequestList")
	//管理员获取某用户的vip申请资料
	beego.Router("/admin/getviprequest", &controllers.AdminController{}, "post:GetVipRequest")
	//管理员获取用户信息
	beego.Router("/admin/getuserinfo", &controllers.AdminController{}, "post:GetUserInfo")
	//管理员同意/反对VIP申请
	beego.Router("/admin/agreerequest", &controllers.AdminController{}, "post:AgreeRequest")
	//管理员获取活动List
	beego.Router("/admin/getactivities", &controllers.AdminController{}, "post:GetActivities")
	//管理员发布活动
	beego.Router("/admin/publishactivity", &controllers.AdminController{}, "post:PublishActivity")
	//管理员删除活动
	beego.Router("/admin/deleteactivity", &controllers.AdminController{}, "post:DeleteActivity")
	//管理员删除用户
	beego.Router("/admin/deleteuser", &controllers.AdminController{}, "post:DeleteUser")
	//管理员冻结用户
	beego.Router("/admin/frozenuser", &controllers.AdminController{}, "post:FrozenUser")
	//管理员上传文件
	beego.Router("/admin/uploadpic", &controllers.AdminController{}, "post:UploadPhoto")

}
